<%-- 
    Document   : index.jsp
    Created on : 03.12.2012, 17:01:37
    Author     : Katharina Tagwerker
--%>

<%@page import="sun.swing.PrintColorUIResource"%>
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">  
<html>
<head>
		<title>bookShare</title>
                <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
		<link rel="stylesheet" type="text/css" href="elements.css">
                <link rel="stylesheet" type="text/css" href="ids.css">
                <link rel="stylesheet" type="text/css" href="classes.css">
		<link href='http://fonts.googleapis.com/css?family=Ruluko' rel='stylesheet' type='text/css'>
</head>
<body>
    
    <div id="header">
	<a href="index.jsp"><img src="logo_klein.png"></a>
	<div id="menu">
		<ul id="menu_list">
			<li><a href="index.jsp">HOME</a></li>
			<li><a href="index.jsp?param1=products">KAUFEN</a></li>
			<li><a href="index.jsp?param1=verkaufen">VERKAUFEN</a></li>
			<li><a href="index.jsp?param1=profil">PROFIL</a></li>
		</ul>
	</div>
    </div>
    
    <div id="content">
        
                    <%-- Wenn Parameter1 leer ist, dann home seite anzeigen --%>
			<% String param1 = request.getParameter("param1");
                    	String param2 = request.getParameter("param2");
                    	String param3 = request.getParameter("param3");
                        String param4 = request.getParameter("param4");
                        String param5 = request.getParameter("param5");
                        String error = request.getParameter("error");
                        if(error != null && error.equals("2")) { %>
                            <%@ include file="error2.html" %>
                        <% } %>
                        <% if(error != null && error.equals("3")) { %>
                             <%@ include file="error3.html" %>
                        <% }
                        if(param1 == null) { %>
                            <%@ include file="home.html" %>
                        <% } %>
                    
                    <%-- show login form except when loginCorrect == true --%>
                    <%  if((session.getAttribute("loginCorrect") == null || 
                          ((Boolean)session.getAttribute("loginCorrect") == false)) &&
                             (param1 == null)) { %>
                          <div>
                             <%@include file="loginform.html" %>
                          </div>
                   <% } %>

                   <%-- Registrierformular --%>
                   <% if(param1 != null && param1.equals("regis")) { 
                        if(param2 == null) { %>
                            <%@include file="registrierung.html" %>
                        <% }
                        if(param2 != null && param2.equals("regissuccess")) { %>
                            <%@include  file="regissuccess.html"%>
                   <% } } %>

                   <%-- Link Kaufen -> Artikelkategorien zeigen
                        Bücher, Skripte, Software --%>
                   <% if(param1 != null && param1.equals("products")) { %>
                	 <% if(param2 != null && param2.equals("buch")) { %>
                         	<%@include file="showbooks.jsp" %>
                         <% } else if(param2 != null && param2.equals("skriptum")) { %>
                             <%@include file="showscripts.jsp" %>
                         <% } else if(param2 != null && param2.equals("software")){ %>
                             <%@include file="showsoftware.jsp" %>
                         <% } else { %>
                             <%@include file="showproducts.jsp" %>
                   <% } } %>
                   
                   <%-- Link Profil --%>
                   <% if(param1 != null && param1.equals("profil")) { %>
                       <%@include file="profile.jsp" %>
                   <% } %>
                   
                   <%-- check if session attribute was initiated --%>
                   <%  if(session.getAttribute("loginCorrect") != null) { %>
                    
                        <%-- check if login was correct --%>
                        <% 	if (((Boolean)session.getAttribute("loginCorrect") == true)) { %>
                            
                            
                            <%-- if param == "verkaufen" Verkaufen seite anzeigen --%>
                            <% if(param1 != null && param1.equals("verkaufen")) { %>
                            
                                <%-- error Ausgabe, wenn das Formular nicht korrekt ausgefüllt wurde --%>
                                <% if(error != null && error.equals("1")) { %>
                                    <%@ include file="error1.html" %>
                                <% } %>
                                <% if(param2 != null && param2.equals("success")) { %>
                                    <%@include file="success.html" %>
                                <% } else { %>
                                    <%@ include file="verkaufen.html" %>
                            <% } } %>
                            
                            <%-- show logout button --%>
                            <%@ include file="logout.html" %>
                         
                   <% } } %>
                    
                   
		</div>
                        
	</body>
</html>